package com.example.lin.util;

import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @className: IdUtils
 * @description: ID序列号
 * @author: Lin.Gu
 * @date: 2025/6/4
 */
public class IdUtils {

    // 原子变量 递增
    public static AtomicInteger i = new AtomicInteger(1);

    public static String getId() {
        int andIncrement = i.getAndIncrement();
        return DateUtils.format(new Date(), DateUtils.YMDHS_FORMAT) + String.format("%06d", andIncrement);
    }
}
